package org.dromara.iot.enums;

import com.fasterxml.jackson.annotation.JsonCreator;
import lombok.Getter;

/**
 * 平层状态枚举
 */
@Getter
public enum LevelingStatusEnum {
    NOT_LEVEL(0, "非平层"),
    LEVEL(1, "平层");

    private final int code;
    private final String description;

    LevelingStatusEnum(int code, String description) {
        this.code = code;
        this.description = description;
    }

    /**
     * 根据code获取枚举
     */
    @JsonCreator
    public static LevelingStatusEnum getByCode(int code) {
        for (LevelingStatusEnum status : values()) {
            if (status.code == code) {
                return status;
            }
        }
        return null;
    }
}